/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package tpgen.grammar;

import java.util.Random;

/**
 *
 * @author shanki
 */
public class Context {
    private Random rg;
    private Variables variables;

    Context(Random rg, Variables variables) {
        this.rg         = rg;
        this.variables  = variables;
    }

    double nextDouble() {
        return rg.nextDouble();
    }

    Variable getRandomVariable(Symbol type) {
        int index = rg.nextInt(variables.size(type));
        return variables.get(type,index);
    }

    int getRandomNonNegativeInteger() {
        return rg.nextInt(4);
    }
}
